home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / netBoot.new / sun3src / blts.s < prev    next >
Encoding:
Text File  |  1990-12-19  |  2.3 KB  |  131 lines

  1.  
  2. |
  3. |    @(#)blts.s 1.1 86/09/27
  4. |    Copyright (c) 1986 by Sun Microsystems, Inc.
  5.  
  6.     .globl    _bltshort, _setshort
  7.  
  8. argmsk = 0x0700    | pick up a2, a1, a0 from stacked args
  9. args = 8    | Args at offset 8 from sp
  10. |lo = a0    | First arg in a0 -- low end address
  11. |hi = a1    | 2nd arg in a1 -- high end address
  12. |destlo = a2    | 3rd arg in a2 -- destination low address
  13. |fillval = a2    | 3rd arg in a2 -- fill value for setshort.
  14.  
  15. |    bltshort(a0, a1, a2);
  16.  
  17. _bltshort:
  18.     movl    a2,sp@-
  19.     moveml    sp@(args),#argmsk    | args to regs
  20.     movl    a1,d0    | move how many?
  21.     subl    a0,d0
  22.     jeq    done    | none!
  23.     cmpl    a2,a1
  24.     jle    forward
  25.     cmpl    a2,a0
  26.     jlt    backward
  27.     jeq    done
  28.  
  29. |    forward-moving loop:
  30. forward:
  31.     asrl    #1,d0    | (shorts not bytes)
  32.     subql    #8,d0    | 8 more to do?
  33.     jle    fsmall
  34. fbig:
  35.     movw    a0@+,a2@+
  36.     movw    a0@+,a2@+
  37.     movw    a0@+,a2@+
  38.     movw    a0@+,a2@+
  39.     movw    a0@+,a2@+
  40.     movw    a0@+,a2@+
  41.     movw    a0@+,a2@+
  42.     movw    a0@+,a2@+
  43.     subql    #8,d0    | 8 more to do?
  44.     jge    fbig
  45. fsmall:
  46.     negw    d0    | (8 - cnt&7)
  47.     aslw    #1,d0    | (to words)
  48.     jmp    pc@(2,d0:w)
  49.     movw    a0@+,a2@+
  50.     movw    a0@+,a2@+
  51.     movw    a0@+,a2@+
  52.     movw    a0@+,a2@+
  53.     movw    a0@+,a2@+
  54.     movw    a0@+,a2@+
  55.     movw    a0@+,a2@+
  56.     movw    a0@+,a2@+
  57. done:
  58.     movl    sp@+,a2        | restore saved reg
  59.     rts
  60.  
  61. |    backward-moving loop:
  62. backward:
  63.     cmpl    a0,a2
  64.     jeq    done
  65.     addl    d0,a2    | (bump destination to end)
  66.     asrl    #1,d0    | (shorts not bytes)
  67.     subql    #8,d0    | 8 more to do?
  68.     jle    bsmall
  69. bbig:
  70.     movw    a1@-,a2@-
  71.     movw    a1@-,a2@-
  72.     movw    a1@-,a2@-
  73.     movw    a1@-,a2@-
  74.     movw    a1@-,a2@-
  75.     movw    a1@-,a2@-
  76.     movw    a1@-,a2@-
  77.     movw    a1@-,a2@-
  78.     subql    #8,d0    | 8 more to do?
  79.     jge    bbig
  80. bsmall:
  81.     negw    d0    | (8 - cnt&7)
  82.     aslw    #1,d0    | (to words)
  83.     jmp    pc@(2,d0:w)
  84.     movw    a1@-,a2@-    |d0 = 0
  85.     movw    a1@-,a2@-    |d0 = 1<<1
  86.     movw    a1@-,a2@-    |d0 = 2<<1, etc
  87.     movw    a1@-,a2@-
  88.     movw    a1@-,a2@-
  89.     movw    a1@-,a2@-
  90.     movw    a1@-,a2@-
  91.     movw    a1@-,a2@-
  92.     jra    done
  93.  
  94. |    setshort(lo, hi, fillval);
  95.  
  96. _setshort:
  97.     movl    a2,sp@-
  98.     moveml    sp@(args),#argmsk    | args to regs
  99.     movl    a1,d0    | move how many?
  100.     subl    a0,d0
  101.     jeq    sdone    | none!
  102.     asrl    #1,d0    | (shorts not bytes)
  103.     subql    #8,d0    | 8 more to do?
  104.     jle    ssmall
  105. sbig:
  106.     movw    a2,a0@+
  107.     movw    a2,a0@+
  108.     movw    a2,a0@+
  109.     movw    a2,a0@+
  110.     movw    a2,a0@+
  111.     movw    a2,a0@+
  112.     movw    a2,a0@+
  113.     movw    a2,a0@+
  114.     subql    #8,d0    | 8 more to do?
  115.     jge    sbig
  116. ssmall:
  117.     negw    d0    | (8 - cnt&7)
  118.     aslw    #1,d0    | (to words)
  119.     jmp    pc@(2,d0:w)
  120.     movw    a2,a0@+
  121.     movw    a2,a0@+
  122.     movw    a2,a0@+
  123.     movw    a2,a0@+
  124.     movw    a2,a0@+
  125.     movw    a2,a0@+
  126.     movw    a2,a0@+
  127.     movw    a2,a0@+
  128. sdone:
  129.     movl    sp@+,a2        | restore saved reg(s)
  130.     rts
  131.